<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - ged.info - gil/color_base_algorithm.hpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">gil</a> - color_base_algorithm.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>ged.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2009-06-09</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">12</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">100.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">12</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :     Copyright 2005-2007 Adobe Systems Incorporated
<span class="lineNum">       3 </span>                :    
<span class="lineNum">       4 </span>                :     Use, modification and distribution are subject to the Boost Software License,
<span class="lineNum">       5 </span>                :     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       6 </span>                :     http://www.boost.org/LICENSE_1_0.txt).
<span class="lineNum">       7 </span>                : 
<span class="lineNum">       8 </span>                :     See http://opensource.adobe.com/gil for most recent version including documentation.
<span class="lineNum">       9 </span>                : */
<span class="lineNum">      10 </span>                : 
<span class="lineNum">      11 </span>                : /*************************************************************************************************/
<span class="lineNum">      12 </span>                : 
<span class="lineNum">      13 </span>                : #ifndef GIL_COLOR_BASE_ALGORITHM_HPP
<span class="lineNum">      14 </span>                : #define GIL_COLOR_BASE_ALGORITHM_HPP
<span class="lineNum">      15 </span>                : 
<span class="lineNum">      16 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      17 </span>                : /// \file               
<span class="lineNum">      18 </span>                : /// \brief pixel related algorithms
<span class="lineNum">      19 </span>                : /// \author Lubomir Bourdev and Hailin Jin \n
<span class="lineNum">      20 </span>                : ///         Adobe Systems Incorporated
<span class="lineNum">      21 </span>                : /// \date   2005-2007 \n Last updated on February 16, 2007
<span class="lineNum">      22 </span>                : ///
<span class="lineNum">      23 </span>                : ////////////////////////////////////////////////////////////////////////////////////////
<span class="lineNum">      24 </span>                : 
<span class="lineNum">      25 </span>                : #include &lt;algorithm&gt;
<span class="lineNum">      26 </span>                : #include &lt;boost/type_traits.hpp&gt;
<span class="lineNum">      27 </span>                : #include &lt;boost/utility/enable_if.hpp&gt;
<span class="lineNum">      28 </span>                : #include &lt;boost/mpl/contains.hpp&gt;
<span class="lineNum">      29 </span>                : #include &lt;boost/mpl/at.hpp&gt;
<span class="lineNum">      30 </span>                : #include &quot;gil_config.hpp&quot;
<span class="lineNum">      31 </span>                : #include &quot;gil_concept.hpp&quot;
<span class="lineNum">      32 </span>                : #include &quot;utilities.hpp&quot;
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span>                : namespace boost { namespace gil {
<span class="lineNum">      35 </span>                : 
<span class="lineNum">      36 </span>                : 
<span class="lineNum">      37 </span>                : ///////////////////////////////////////
<span class="lineNum">      38 </span>                : ///
<span class="lineNum">      39 </span>                : /// size:   Semantic channel size
<span class="lineNum">      40 </span>                : ///
<span class="lineNum">      41 </span>                : ///////////////////////////////////////
<span class="lineNum">      42 </span>                : 
<span class="lineNum">      43 </span>                : /**
<span class="lineNum">      44 </span>                : \defgroup ColorBaseAlgorithmSize size
<span class="lineNum">      45 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">      46 </span>                : \brief Returns an MPL integral type specifying the number of elements in a color base
<span class="lineNum">      47 </span>                : 
<span class="lineNum">      48 </span>                : Example:
<span class="lineNum">      49 </span>                : \code
<span class="lineNum">      50 </span>                : BOOST_STATIC_ASSERT((size&lt;rgb8_pixel_t&gt;::value == 3));
<span class="lineNum">      51 </span>                : BOOST_STATIC_ASSERT((size&lt;cmyk8_planar_ptr_t&gt;::value == 4));
<span class="lineNum">      52 </span>                : \endcode
<span class="lineNum">      53 </span>                : */
<span class="lineNum">      54 </span>                : 
<span class="lineNum">      55 </span>                : /// \brief Returns an MPL integral type specifying the number of elements in a color base
<span class="lineNum">      56 </span>                : /// \ingroup ColorBaseAlgorithmSize
<span class="lineNum">      57 </span>                : template &lt;typename ColorBase&gt;
<span class="lineNum">      58 </span>                : struct size : public mpl::size&lt;typename ColorBase::layout_t::color_space_t&gt; {};
<span class="lineNum">      59 </span>                : 
<span class="lineNum">      60 </span>                : ///////////////////////////////////////
<span class="lineNum">      61 </span>                : ///
<span class="lineNum">      62 </span>                : /// semantic_at_c:   Semantic channel accessors
<span class="lineNum">      63 </span>                : ///
<span class="lineNum">      64 </span>                : ///////////////////////////////////////
<span class="lineNum">      65 </span>                : 
<span class="lineNum">      66 </span>                : /**
<span class="lineNum">      67 </span>                : \defgroup ColorBaseAlgorithmSemanticAtC kth_semantic_element_type, kth_semantic_element_reference_type, kth_semantic_element_const_reference_type, semantic_at_c
<span class="lineNum">      68 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">      69 </span>                : \brief Support for accessing the elements of a color base by semantic index
<span class="lineNum">      70 </span>                : 
<span class="lineNum">      71 </span>                : The semantic index of an element is the index of its color in the color space. Semantic indexing allows for proper pairing of elements of color bases
<span class="lineNum">      72 </span>                : independent on their layout. For example, red is the first semantic element of a color base regardless of whether it has an RGB layout or a BGR layout.
<span class="lineNum">      73 </span>                : All GIL color base algorithms taking multiple color bases use semantic indexing to access their elements.
<span class="lineNum">      74 </span>                : 
<span class="lineNum">      75 </span>                : Example:
<span class="lineNum">      76 </span>                : \code
<span class="lineNum">      77 </span>                : // 16-bit BGR pixel, 4 bits for the blue, 3 bits for the green, 2 bits for the red channel and 7 unused bits
<span class="lineNum">      78 </span>                : typedef packed_pixel_type&lt;uint16_t, mpl::vector3_c&lt;unsigned,4,3,2&gt;, bgr_layout_t&gt;::type bgr432_pixel_t;
<span class="lineNum">      79 </span>                : 
<span class="lineNum">      80 </span>                : // A reference to its red channel. Although the red channel is the third, its semantic index is 0 in the RGB color space
<span class="lineNum">      81 </span>                : typedef kth_semantic_element_reference_type&lt;bgr432_pixel_t, 0&gt;::type red_channel_reference_t;
<span class="lineNum">      82 </span>                : 
<span class="lineNum">      83 </span>                : // Initialize the pixel to black
<span class="lineNum">      84 </span>                : bgr432_pixel_t red_pixel(0,0,0);
<span class="lineNum">      85 </span>                : 
<span class="lineNum">      86 </span>                : // Set the red channel to 100%
<span class="lineNum">      87 </span>                : red_channel_reference_t red_channel = semantic_at_c&lt;0&gt;(red_pixel);
<span class="lineNum">      88 </span>                : red_channel = channel_traits&lt;red_channel_reference_t&gt;::max_value();       
<span class="lineNum">      89 </span>                : 
<span class="lineNum">      90 </span>                : \endcode
<span class="lineNum">      91 </span>                : */
<span class="lineNum">      92 </span>                : /// \brief Specifies the type of the K-th semantic element of a color base
<span class="lineNum">      93 </span>                : /// \ingroup ColorBaseAlgorithmSemanticAtC
<span class="lineNum">      94 </span>                : template &lt;typename ColorBase, int K&gt; struct kth_semantic_element_type {
<span class="lineNum">      95 </span>                :     BOOST_STATIC_CONSTANT(int, semantic_index = (mpl::at_c&lt;typename ColorBase::layout_t::channel_mapping_t,K&gt;::type::value));
<span class="lineNum">      96 </span>                :     typedef typename kth_element_type&lt;ColorBase, semantic_index&gt;::type type;
<span class="lineNum">      97 </span>                : };
<span class="lineNum">      98 </span>                : 
<span class="lineNum">      99 </span>                : /// \brief Specifies the return type of the mutable semantic_at_c&lt;K&gt;(color_base);
<span class="lineNum">     100 </span>                : /// \ingroup ColorBaseAlgorithmSemanticAtC
<span class="lineNum">     101 </span>                : template &lt;typename ColorBase, int K&gt; struct kth_semantic_element_reference_type {
<span class="lineNum">     102 </span>                :     BOOST_STATIC_CONSTANT(int, semantic_index = (mpl::at_c&lt;typename ColorBase::layout_t::channel_mapping_t,K&gt;::type::value));
<span class="lineNum">     103 </span>                :     typedef typename kth_element_reference_type&lt;ColorBase,semantic_index&gt;::type type;
<span class="lineNum">     104 </span><span class="lineCov">         428796 :     static type       get(ColorBase&amp; cb) { return at_c&lt;semantic_index&gt;(cb); }</span>
<span class="lineNum">     105 </span>                : };
<span class="lineNum">     106 </span>                : 
<span class="lineNum">     107 </span>                : /// \brief Specifies the return type of the constant semantic_at_c&lt;K&gt;(color_base);
<span class="lineNum">     108 </span>                : /// \ingroup ColorBaseAlgorithmSemanticAtC
<span class="lineNum">     109 </span>                : template &lt;typename ColorBase, int K&gt; struct kth_semantic_element_const_reference_type {
<span class="lineNum">     110 </span>                :     BOOST_STATIC_CONSTANT(int, semantic_index = (mpl::at_c&lt;typename ColorBase::layout_t::channel_mapping_t,K&gt;::type::value));
<span class="lineNum">     111 </span>                :     typedef typename kth_element_const_reference_type&lt;ColorBase,semantic_index&gt;::type type;
<span class="lineNum">     112 </span><span class="lineCov">         428796 :     static type       get(const ColorBase&amp; cb) { return at_c&lt;semantic_index&gt;(cb); }</span>
<span class="lineNum">     113 </span>                : };
<span class="lineNum">     114 </span>                : 
<span class="lineNum">     115 </span>                : /// \brief A mutable accessor to the K-th semantic element of a color base
<span class="lineNum">     116 </span>                : /// \ingroup ColorBaseAlgorithmSemanticAtC
<span class="lineNum">     117 </span>                : template &lt;int K, typename ColorBase&gt; inline
<span class="lineNum">     118 </span>                : typename disable_if&lt;is_const&lt;ColorBase&gt;,typename kth_semantic_element_reference_type&lt;ColorBase,K&gt;::type&gt;::type
<span class="lineNum">     119 </span><span class="lineCov">         428796 : semantic_at_c(ColorBase&amp; p) { </span>
<span class="lineNum">     120 </span><span class="lineCov">         428796 :     return kth_semantic_element_reference_type&lt;ColorBase,K&gt;::get(p); </span>
<span class="lineNum">     121 </span>                : }
<span class="lineNum">     122 </span>                : 
<span class="lineNum">     123 </span>                : /// \brief A constant accessor to the K-th semantic element of a color base
<span class="lineNum">     124 </span>                : /// \ingroup ColorBaseAlgorithmSemanticAtC
<span class="lineNum">     125 </span>                : template &lt;int K, typename ColorBase&gt; inline
<span class="lineNum">     126 </span>                : typename kth_semantic_element_const_reference_type&lt;ColorBase,K&gt;::type
<span class="lineNum">     127 </span><span class="lineCov">         428796 : semantic_at_c(const ColorBase&amp; p) { </span>
<span class="lineNum">     128 </span><span class="lineCov">         428796 :     return kth_semantic_element_const_reference_type&lt;ColorBase,K&gt;::get(p); </span>
<span class="lineNum">     129 </span>                : }
<span class="lineNum">     130 </span>                : 
<span class="lineNum">     131 </span>                : ///////////////////////////////////////
<span class="lineNum">     132 </span>                : ///
<span class="lineNum">     133 </span>                : /// get_color:   Named channel accessors
<span class="lineNum">     134 </span>                : ///
<span class="lineNum">     135 </span>                : ///////////////////////////////////////
<span class="lineNum">     136 </span>                : 
<span class="lineNum">     137 </span>                : /**
<span class="lineNum">     138 </span>                : \defgroup ColorBaseAlgorithmColor color_element_type, color_element_reference_type, color_element_const_reference_type, get_color, contains_color
<span class="lineNum">     139 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     140 </span>                : \brief Support for accessing the elements of a color base by color name
<span class="lineNum">     141 </span>                : 
<span class="lineNum">     142 </span>                : Example: A function that takes a generic pixel containing a red channel and sets it to 100%:
<span class="lineNum">     143 </span>                : 
<span class="lineNum">     144 </span>                : \code
<span class="lineNum">     145 </span>                : template &lt;typename Pixel&gt;
<span class="lineNum">     146 </span>                : void set_red_to_max(Pixel&amp; pixel) {
<span class="lineNum">     147 </span>                :     boost::function_requires&lt;MutablePixelConcept&lt;Pixel&gt; &gt;();
<span class="lineNum">     148 </span>                :     BOOST_STATIC_ASSERT((contains_color&lt;Pixel, red_t&gt;::value));
<span class="lineNum">     149 </span>                : 
<span class="lineNum">     150 </span>                :     typedef typename color_element_type&lt;Pixel, red_t&gt;::type red_channel_t;
<span class="lineNum">     151 </span>                :     get_color(pixel, red_t()) = channel_traits&lt;red_channel_t&gt;::max_value(); 
<span class="lineNum">     152 </span>                : }
<span class="lineNum">     153 </span>                : \endcode
<span class="lineNum">     154 </span>                : */
<span class="lineNum">     155 </span>                : 
<span class="lineNum">     156 </span>                : /// \brief A predicate metafunction determining whether a given color base contains a given color
<span class="lineNum">     157 </span>                : /// \ingroup ColorBaseAlgorithmColor
<span class="lineNum">     158 </span>                : template &lt;typename ColorBase, typename Color&gt;
<span class="lineNum">     159 </span>                : struct contains_color : public mpl::contains&lt;typename ColorBase::layout_t::color_space_t,Color&gt; {};
<span class="lineNum">     160 </span>                : 
<span class="lineNum">     161 </span>                : template &lt;typename ColorBase, typename Color&gt;
<span class="lineNum">     162 </span>                : struct color_index_type : public detail::type_to_index&lt;typename ColorBase::layout_t::color_space_t,Color&gt; {};
<span class="lineNum">     163 </span>                : 
<span class="lineNum">     164 </span>                : /// \brief Specifies the type of the element associated with a given color tag
<span class="lineNum">     165 </span>                : /// \ingroup ColorBaseAlgorithmColor
<span class="lineNum">     166 </span>                : template &lt;typename ColorBase, typename Color&gt;
<span class="lineNum">     167 </span>                : struct color_element_type : public kth_semantic_element_type&lt;ColorBase,color_index_type&lt;ColorBase,Color&gt;::value&gt; {};
<span class="lineNum">     168 </span>                : 
<span class="lineNum">     169 </span>                : /// \brief Specifies the return type of the mutable element accessor by color name, get_color(color_base, Color());
<span class="lineNum">     170 </span>                : /// \ingroup ColorBaseAlgorithmColor
<span class="lineNum">     171 </span>                : template &lt;typename ColorBase, typename Color&gt;
<span class="lineNum">     172 </span>                : struct color_element_reference_type : public kth_semantic_element_reference_type&lt;ColorBase,color_index_type&lt;ColorBase,Color&gt;::value&gt; {};
<span class="lineNum">     173 </span>                : 
<span class="lineNum">     174 </span>                : /// \brief Specifies the return type of the constant element accessor by color name, get_color(color_base, Color());
<span class="lineNum">     175 </span>                : /// \ingroup ColorBaseAlgorithmColor
<span class="lineNum">     176 </span>                : template &lt;typename ColorBase, typename Color&gt;
<span class="lineNum">     177 </span>                : struct color_element_const_reference_type : public kth_semantic_element_const_reference_type&lt;ColorBase,color_index_type&lt;ColorBase,Color&gt;::value&gt; {};
<span class="lineNum">     178 </span>                : 
<span class="lineNum">     179 </span>                : /// \brief Mutable accessor to the element associated with a given color name
<span class="lineNum">     180 </span>                : /// \ingroup ColorBaseAlgorithmColor
<span class="lineNum">     181 </span>                : template &lt;typename ColorBase, typename Color&gt; 
<span class="lineNum">     182 </span>                : typename color_element_reference_type&lt;ColorBase,Color&gt;::type get_color(ColorBase&amp; cb, Color=Color()) {
<span class="lineNum">     183 </span>                :     return color_element_reference_type&lt;ColorBase,Color&gt;::get(cb);
<span class="lineNum">     184 </span>                : }
<span class="lineNum">     185 </span>                : 
<span class="lineNum">     186 </span>                : /// \brief Constant accessor to the element associated with a given color name
<span class="lineNum">     187 </span>                : /// \ingroup ColorBaseAlgorithmColor
<span class="lineNum">     188 </span>                : template &lt;typename ColorBase, typename Color&gt; 
<span class="lineNum">     189 </span>                : typename color_element_const_reference_type&lt;ColorBase,Color&gt;::type get_color(const ColorBase&amp; cb, Color=Color()) {
<span class="lineNum">     190 </span>                :     return color_element_const_reference_type&lt;ColorBase,Color&gt;::get(cb);
<span class="lineNum">     191 </span>                : }
<span class="lineNum">     192 </span>                : 
<span class="lineNum">     193 </span>                : ///////////////////////////////////////
<span class="lineNum">     194 </span>                : ///
<span class="lineNum">     195 </span>                : /// element_type, element_reference_type, element_const_reference_type: Support for homogeneous color bases
<span class="lineNum">     196 </span>                : ///
<span class="lineNum">     197 </span>                : ///////////////////////////////////////
<span class="lineNum">     198 </span>                : 
<span class="lineNum">     199 </span>                : /**
<span class="lineNum">     200 </span>                : \defgroup ColorBaseAlgorithmHomogeneous element_type, element_reference_type, element_const_reference_type
<span class="lineNum">     201 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     202 </span>                : \brief Types for homogeneous color bases
<span class="lineNum">     203 </span>                : 
<span class="lineNum">     204 </span>                : Example:
<span class="lineNum">     205 </span>                : \code
<span class="lineNum">     206 </span>                : typedef element_type&lt;rgb8c_planar_ptr_t&gt;::type element_t;
<span class="lineNum">     207 </span>                : BOOST_STATIC_ASSERT((boost::is_same&lt;element_t, const bits8*&gt;::value));
<span class="lineNum">     208 </span>                : \endcode
<span class="lineNum">     209 </span>                : */
<span class="lineNum">     210 </span>                : /// \brief Specifies the element type of a homogeneous color base
<span class="lineNum">     211 </span>                : /// \ingroup ColorBaseAlgorithmHomogeneous
<span class="lineNum">     212 </span>                : template &lt;typename ColorBase&gt;
<span class="lineNum">     213 </span>                : struct element_type : public kth_element_type&lt;ColorBase, 0&gt; {};
<span class="lineNum">     214 </span>                : 
<span class="lineNum">     215 </span>                : /// \brief Specifies the return type of the mutable element accessor at_c of a homogeneous color base
<span class="lineNum">     216 </span>                : /// \ingroup ColorBaseAlgorithmHomogeneous
<span class="lineNum">     217 </span>                : template &lt;typename ColorBase&gt;
<span class="lineNum">     218 </span>                : struct element_reference_type : public kth_element_reference_type&lt;ColorBase, 0&gt; {};
<span class="lineNum">     219 </span>                : 
<span class="lineNum">     220 </span>                : /// \brief Specifies the return type of the constant element accessor at_c of a homogeneous color base
<span class="lineNum">     221 </span>                : /// \ingroup ColorBaseAlgorithmHomogeneous
<span class="lineNum">     222 </span>                : template &lt;typename ColorBase&gt;
<span class="lineNum">     223 </span>                : struct element_const_reference_type : public kth_element_const_reference_type&lt;ColorBase, 0&gt; {};
<span class="lineNum">     224 </span>                : 
<span class="lineNum">     225 </span>                : 
<span class="lineNum">     226 </span>                : namespace detail {
<span class="lineNum">     227 </span>                : 
<span class="lineNum">     228 </span>                : // compile-time recursion for per-element operations on color bases
<span class="lineNum">     229 </span>                : template &lt;int N&gt;
<span class="lineNum">     230 </span>                : struct element_recursion {
<span class="lineNum">     231 </span>                :     //static_equal
<span class="lineNum">     232 </span>                :     template &lt;typename P1,typename P2&gt;
<span class="lineNum">     233 </span>                :     static bool static_equal(const P1&amp; p1, const P2&amp; p2) { 
<span class="lineNum">     234 </span>                :         return element_recursion&lt;N-1&gt;::static_equal(p1,p2) &amp;&amp;
<span class="lineNum">     235 </span>                :                semantic_at_c&lt;N-1&gt;(p1)==semantic_at_c&lt;N-1&gt;(p2); 
<span class="lineNum">     236 </span>                :     }
<span class="lineNum">     237 </span>                :     //static_copy
<span class="lineNum">     238 </span>                :     template &lt;typename P1,typename P2&gt;
<span class="lineNum">     239 </span><span class="lineCov">         428796 :     static void static_copy(const P1&amp; p1, P2&amp; p2) {</span>
<span class="lineNum">     240 </span><span class="lineCov">         428796 :         element_recursion&lt;N-1&gt;::static_copy(p1,p2);</span>
<span class="lineNum">     241 </span><span class="lineCov">         428796 :         semantic_at_c&lt;N-1&gt;(p2)=semantic_at_c&lt;N-1&gt;(p1);</span>
<span class="lineNum">     242 </span><span class="lineCov">         428796 :     }</span>
<span class="lineNum">     243 </span>                :     //static_fill
<span class="lineNum">     244 </span>                :     template &lt;typename P,typename T2&gt;
<span class="lineNum">     245 </span>                :     static void static_fill(P&amp; p, T2 v) {
<span class="lineNum">     246 </span>                :         element_recursion&lt;N-1&gt;::static_fill(p,v);
<span class="lineNum">     247 </span>                :         semantic_at_c&lt;N-1&gt;(p)=v;
<span class="lineNum">     248 </span>                :     }
<span class="lineNum">     249 </span>                :     //static_generate
<span class="lineNum">     250 </span>                :     template &lt;typename Dst,typename Op&gt; 
<span class="lineNum">     251 </span>                :     static void static_generate(Dst&amp; dst, Op op) {
<span class="lineNum">     252 </span>                :         element_recursion&lt;N-1&gt;::static_generate(dst,op);
<span class="lineNum">     253 </span>                :         semantic_at_c&lt;N-1&gt;(dst)=op();
<span class="lineNum">     254 </span>                :     }
<span class="lineNum">     255 </span>                :     //static_for_each with one source
<span class="lineNum">     256 </span>                :     template &lt;typename P1,typename Op&gt; 
<span class="lineNum">     257 </span>                :     static Op static_for_each(P1&amp; p1, Op op) {
<span class="lineNum">     258 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,op));
<span class="lineNum">     259 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1));
<span class="lineNum">     260 </span>                :         return op2;
<span class="lineNum">     261 </span>                :     }
<span class="lineNum">     262 </span>                :     template &lt;typename P1,typename Op&gt; 
<span class="lineNum">     263 </span>                :     static Op static_for_each(const P1&amp; p1, Op op) {
<span class="lineNum">     264 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,op));
<span class="lineNum">     265 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1));
<span class="lineNum">     266 </span>                :         return op2;
<span class="lineNum">     267 </span>                :     }
<span class="lineNum">     268 </span>                :     //static_for_each with two sources
<span class="lineNum">     269 </span>                :     template &lt;typename P1,typename P2,typename Op&gt; 
<span class="lineNum">     270 </span>                :     static Op static_for_each(P1&amp; p1, P2&amp; p2, Op op) {
<span class="lineNum">     271 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,op));
<span class="lineNum">     272 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2));
<span class="lineNum">     273 </span>                :         return op2;
<span class="lineNum">     274 </span>                :     }
<span class="lineNum">     275 </span>                :     template &lt;typename P1,typename P2,typename Op&gt; 
<span class="lineNum">     276 </span>                :     static Op static_for_each(P1&amp; p1, const P2&amp; p2, Op op) {
<span class="lineNum">     277 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,op));
<span class="lineNum">     278 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2));
<span class="lineNum">     279 </span>                :         return op2;
<span class="lineNum">     280 </span>                :     }
<span class="lineNum">     281 </span>                :     template &lt;typename P1,typename P2,typename Op&gt; 
<span class="lineNum">     282 </span>                :     static Op static_for_each(const P1&amp; p1, P2&amp; p2, Op op) {
<span class="lineNum">     283 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,op));
<span class="lineNum">     284 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2));
<span class="lineNum">     285 </span>                :         return op2;
<span class="lineNum">     286 </span>                :     }
<span class="lineNum">     287 </span>                :     template &lt;typename P1,typename P2,typename Op&gt; 
<span class="lineNum">     288 </span>                :     static Op static_for_each(const P1&amp; p1, const P2&amp; p2, Op op) {
<span class="lineNum">     289 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,op));
<span class="lineNum">     290 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2));
<span class="lineNum">     291 </span>                :         return op2;
<span class="lineNum">     292 </span>                :     }
<span class="lineNum">     293 </span>                :     //static_for_each with three sources
<span class="lineNum">     294 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     295 </span>                :     static Op static_for_each(P1&amp; p1, P2&amp; p2, P3&amp; p3, Op op) {
<span class="lineNum">     296 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,p3,op));
<span class="lineNum">     297 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2), semantic_at_c&lt;N-1&gt;(p3));
<span class="lineNum">     298 </span>                :         return op2;
<span class="lineNum">     299 </span>                :     }
<span class="lineNum">     300 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     301 </span>                :     static Op static_for_each(P1&amp; p1, P2&amp; p2, const P3&amp; p3, Op op) {
<span class="lineNum">     302 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,p3,op));
<span class="lineNum">     303 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2), semantic_at_c&lt;N-1&gt;(p3));
<span class="lineNum">     304 </span>                :         return op2;
<span class="lineNum">     305 </span>                :     }
<span class="lineNum">     306 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     307 </span>                :     static Op static_for_each(P1&amp; p1, const P2&amp; p2, P3&amp; p3, Op op) {
<span class="lineNum">     308 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,p3,op));
<span class="lineNum">     309 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2), semantic_at_c&lt;N-1&gt;(p3));
<span class="lineNum">     310 </span>                :         return op2;
<span class="lineNum">     311 </span>                :     }
<span class="lineNum">     312 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     313 </span>                :     static Op static_for_each(P1&amp; p1, const P2&amp; p2, const P3&amp; p3, Op op) {
<span class="lineNum">     314 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,p3,op));
<span class="lineNum">     315 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2), semantic_at_c&lt;N-1&gt;(p3));
<span class="lineNum">     316 </span>                :         return op2;
<span class="lineNum">     317 </span>                :     }
<span class="lineNum">     318 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     319 </span>                :     static Op static_for_each(const P1&amp; p1, P2&amp; p2, P3&amp; p3, Op op) {
<span class="lineNum">     320 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,p3,op));
<span class="lineNum">     321 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2), semantic_at_c&lt;N-1&gt;(p3));
<span class="lineNum">     322 </span>                :         return op2;
<span class="lineNum">     323 </span>                :     }
<span class="lineNum">     324 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     325 </span>                :     static Op static_for_each(const P1&amp; p1, P2&amp; p2, const P3&amp; p3, Op op) {
<span class="lineNum">     326 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,p3,op));
<span class="lineNum">     327 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2), semantic_at_c&lt;N-1&gt;(p3));
<span class="lineNum">     328 </span>                :         return op2;
<span class="lineNum">     329 </span>                :     }
<span class="lineNum">     330 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     331 </span>                :     static Op static_for_each(const P1&amp; p1, const P2&amp; p2, P3&amp; p3, Op op) {
<span class="lineNum">     332 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,p3,op));
<span class="lineNum">     333 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2), semantic_at_c&lt;N-1&gt;(p3));
<span class="lineNum">     334 </span>                :         return op2;
<span class="lineNum">     335 </span>                :     }
<span class="lineNum">     336 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     337 </span>                :     static Op static_for_each(const P1&amp; p1, const P2&amp; p2, const P3&amp; p3, Op op) {
<span class="lineNum">     338 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_for_each(p1,p2,p3,op));
<span class="lineNum">     339 </span>                :         op2(semantic_at_c&lt;N-1&gt;(p1), semantic_at_c&lt;N-1&gt;(p2), semantic_at_c&lt;N-1&gt;(p3));
<span class="lineNum">     340 </span>                :         return op2;
<span class="lineNum">     341 </span>                :     }
<span class="lineNum">     342 </span>                :     //static_transform with one source
<span class="lineNum">     343 </span>                :     template &lt;typename P1,typename Dst,typename Op&gt; 
<span class="lineNum">     344 </span>                :     static Op static_transform(P1&amp; src, Dst&amp; dst, Op op) {
<span class="lineNum">     345 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_transform(src,dst,op));
<span class="lineNum">     346 </span>                :         semantic_at_c&lt;N-1&gt;(dst)=op2(semantic_at_c&lt;N-1&gt;(src));
<span class="lineNum">     347 </span>                :         return op2;
<span class="lineNum">     348 </span>                :     }
<span class="lineNum">     349 </span>                :     template &lt;typename P1,typename Dst,typename Op&gt; 
<span class="lineNum">     350 </span>                :     static Op static_transform(const P1&amp; src, Dst&amp; dst, Op op) {
<span class="lineNum">     351 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_transform(src,dst,op));
<span class="lineNum">     352 </span>                :         semantic_at_c&lt;N-1&gt;(dst)=op2(semantic_at_c&lt;N-1&gt;(src));
<span class="lineNum">     353 </span>                :         return op2;
<span class="lineNum">     354 </span>                :     }
<span class="lineNum">     355 </span>                :     //static_transform with two sources
<span class="lineNum">     356 </span>                :     template &lt;typename P1,typename P2,typename Dst,typename Op&gt;
<span class="lineNum">     357 </span>                :     static Op static_transform(P1&amp; src1, P2&amp; src2, Dst&amp; dst, Op op) {
<span class="lineNum">     358 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_transform(src1,src2,dst,op));
<span class="lineNum">     359 </span>                :         semantic_at_c&lt;N-1&gt;(dst)=op2(semantic_at_c&lt;N-1&gt;(src1), semantic_at_c&lt;N-1&gt;(src2));
<span class="lineNum">     360 </span>                :         return op2;
<span class="lineNum">     361 </span>                :     }
<span class="lineNum">     362 </span>                :     template &lt;typename P1,typename P2,typename Dst,typename Op&gt;
<span class="lineNum">     363 </span>                :     static Op static_transform(P1&amp; src1, const P2&amp; src2, Dst&amp; dst, Op op) {
<span class="lineNum">     364 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_transform(src1,src2,dst,op));
<span class="lineNum">     365 </span>                :         semantic_at_c&lt;N-1&gt;(dst)=op2(semantic_at_c&lt;N-1&gt;(src1), semantic_at_c&lt;N-1&gt;(src2));
<span class="lineNum">     366 </span>                :         return op2;
<span class="lineNum">     367 </span>                :     }
<span class="lineNum">     368 </span>                :     template &lt;typename P1,typename P2,typename Dst,typename Op&gt;
<span class="lineNum">     369 </span>                :     static Op static_transform(const P1&amp; src1, P2&amp; src2, Dst&amp; dst, Op op) {
<span class="lineNum">     370 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_transform(src1,src2,dst,op));
<span class="lineNum">     371 </span>                :         semantic_at_c&lt;N-1&gt;(dst)=op2(semantic_at_c&lt;N-1&gt;(src1), semantic_at_c&lt;N-1&gt;(src2));
<span class="lineNum">     372 </span>                :         return op2;
<span class="lineNum">     373 </span>                :     }
<span class="lineNum">     374 </span>                :     template &lt;typename P1,typename P2,typename Dst,typename Op&gt;
<span class="lineNum">     375 </span>                :     static Op static_transform(const P1&amp; src1, const P2&amp; src2, Dst&amp; dst, Op op) {
<span class="lineNum">     376 </span>                :         Op op2(element_recursion&lt;N-1&gt;::static_transform(src1,src2,dst,op));
<span class="lineNum">     377 </span>                :         semantic_at_c&lt;N-1&gt;(dst)=op2(semantic_at_c&lt;N-1&gt;(src1), semantic_at_c&lt;N-1&gt;(src2));
<span class="lineNum">     378 </span>                :         return op2;
<span class="lineNum">     379 </span>                :     }
<span class="lineNum">     380 </span>                : };
<span class="lineNum">     381 </span>                : 
<span class="lineNum">     382 </span>                : // Termination condition of the compile-time recursion for element operations on a color base
<span class="lineNum">     383 </span>                : template&lt;&gt; struct element_recursion&lt;0&gt; {
<span class="lineNum">     384 </span>                :     //static_equal
<span class="lineNum">     385 </span>                :     template &lt;typename P1,typename P2&gt;
<span class="lineNum">     386 </span>                :     static bool static_equal(const P1&amp;, const P2&amp;) { return true; }
<span class="lineNum">     387 </span>                :     //static_copy
<span class="lineNum">     388 </span>                :     template &lt;typename P1,typename P2&gt;
<span class="lineNum">     389 </span><span class="lineCov">         142932 :     static void static_copy(const P1&amp;, const P2&amp;) {}</span>
<span class="lineNum">     390 </span>                :     //static_fill
<span class="lineNum">     391 </span>                :     template &lt;typename P, typename T2&gt;
<span class="lineNum">     392 </span>                :     static void static_fill(const P&amp;, T2) {}
<span class="lineNum">     393 </span>                :     //static_generate
<span class="lineNum">     394 </span>                :     template &lt;typename Dst,typename Op&gt;
<span class="lineNum">     395 </span>                :     static void static_generate(const Dst&amp;,Op){}
<span class="lineNum">     396 </span>                :     //static_for_each with one source
<span class="lineNum">     397 </span>                :     template &lt;typename P1,typename Op&gt;
<span class="lineNum">     398 </span>                :     static Op static_for_each(const P1&amp;,Op op){return op;}
<span class="lineNum">     399 </span>                :     //static_for_each with two sources
<span class="lineNum">     400 </span>                :     template &lt;typename P1,typename P2,typename Op&gt;
<span class="lineNum">     401 </span>                :     static Op static_for_each(const P1&amp;,const P2&amp;,Op op){return op;}
<span class="lineNum">     402 </span>                :     //static_for_each with three sources
<span class="lineNum">     403 </span>                :     template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     404 </span>                :     static Op static_for_each(const P1&amp;,const P2&amp;,const P3&amp;,Op op){return op;}
<span class="lineNum">     405 </span>                :     //static_transform with one source
<span class="lineNum">     406 </span>                :     template &lt;typename P1,typename Dst,typename Op&gt;
<span class="lineNum">     407 </span>                :     static Op static_transform(const P1&amp;,const Dst&amp;,Op op){return op;}
<span class="lineNum">     408 </span>                :     //static_transform with two sources
<span class="lineNum">     409 </span>                :     template &lt;typename P1,typename P2,typename Dst,typename Op&gt;
<span class="lineNum">     410 </span>                :     static Op static_transform(const P1&amp;,const P2&amp;,const Dst&amp;,Op op){return op;}
<span class="lineNum">     411 </span>                : };
<span class="lineNum">     412 </span>                : 
<span class="lineNum">     413 </span>                : // std::min and std::max don't have the mutable overloads...
<span class="lineNum">     414 </span>                : template &lt;typename Q&gt; inline const Q&amp; mutable_min(const Q&amp; x, const Q&amp; y) { return x&lt;y ? x : y; }
<span class="lineNum">     415 </span>                : template &lt;typename Q&gt; inline       Q&amp; mutable_min(      Q&amp; x,       Q&amp; y) { return x&lt;y ? x : y; }
<span class="lineNum">     416 </span>                : template &lt;typename Q&gt; inline const Q&amp; mutable_max(const Q&amp; x, const Q&amp; y) { return x&lt;y ? y : x; }
<span class="lineNum">     417 </span>                : template &lt;typename Q&gt; inline       Q&amp; mutable_max(      Q&amp; x,       Q&amp; y) { return x&lt;y ? y : x; }
<span class="lineNum">     418 </span>                : 
<span class="lineNum">     419 </span>                : 
<span class="lineNum">     420 </span>                : // compile-time recursion for min/max element
<span class="lineNum">     421 </span>                : template &lt;int N&gt;
<span class="lineNum">     422 </span>                : struct min_max_recur {
<span class="lineNum">     423 </span>                :     template &lt;typename P&gt; static typename element_const_reference_type&lt;P&gt;::type max_(const P&amp; p) {
<span class="lineNum">     424 </span>                :         return mutable_max(min_max_recur&lt;N-1&gt;::max_(p),semantic_at_c&lt;N-1&gt;(p));
<span class="lineNum">     425 </span>                :     }    
<span class="lineNum">     426 </span>                :     template &lt;typename P&gt; static typename element_reference_type&lt;P&gt;::type       max_(      P&amp; p) {
<span class="lineNum">     427 </span>                :         return mutable_max(min_max_recur&lt;N-1&gt;::max_(p),semantic_at_c&lt;N-1&gt;(p));
<span class="lineNum">     428 </span>                :     }    
<span class="lineNum">     429 </span>                :     template &lt;typename P&gt; static typename element_const_reference_type&lt;P&gt;::type min_(const P&amp; p) {
<span class="lineNum">     430 </span>                :         return mutable_min(min_max_recur&lt;N-1&gt;::min_(p),semantic_at_c&lt;N-1&gt;(p));
<span class="lineNum">     431 </span>                :     }    
<span class="lineNum">     432 </span>                :     template &lt;typename P&gt; static typename element_reference_type&lt;P&gt;::type       min_(      P&amp; p) {
<span class="lineNum">     433 </span>                :         return mutable_min(min_max_recur&lt;N-1&gt;::min_(p),semantic_at_c&lt;N-1&gt;(p));
<span class="lineNum">     434 </span>                :     }    
<span class="lineNum">     435 </span>                : };
<span class="lineNum">     436 </span>                : 
<span class="lineNum">     437 </span>                : // termination condition of the compile-time recursion for min/max element
<span class="lineNum">     438 </span>                : template &lt;&gt;
<span class="lineNum">     439 </span>                : struct min_max_recur&lt;1&gt; {
<span class="lineNum">     440 </span>                :     template &lt;typename P&gt; static typename element_const_reference_type&lt;P&gt;::type max_(const P&amp; p) { return semantic_at_c&lt;0&gt;(p); }
<span class="lineNum">     441 </span>                :     template &lt;typename P&gt; static typename element_reference_type&lt;P&gt;::type       max_(      P&amp; p) { return semantic_at_c&lt;0&gt;(p); }
<span class="lineNum">     442 </span>                :     template &lt;typename P&gt; static typename element_const_reference_type&lt;P&gt;::type min_(const P&amp; p) { return semantic_at_c&lt;0&gt;(p); }
<span class="lineNum">     443 </span>                :     template &lt;typename P&gt; static typename element_reference_type&lt;P&gt;::type       min_(      P&amp; p) { return semantic_at_c&lt;0&gt;(p); }
<span class="lineNum">     444 </span>                : };
<span class="lineNum">     445 </span>                : }  // namespace detail
<span class="lineNum">     446 </span>                : 
<span class="lineNum">     447 </span>                : 
<span class="lineNum">     448 </span>                : /**
<span class="lineNum">     449 </span>                : \defgroup ColorBaseAlgorithmMinMax static_min, static_max
<span class="lineNum">     450 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     451 </span>                : \brief Equivalents to std::min_element and std::max_element for homogeneous color bases
<span class="lineNum">     452 </span>                : 
<span class="lineNum">     453 </span>                : Example:
<span class="lineNum">     454 </span>                : \code
<span class="lineNum">     455 </span>                : rgb8_pixel_t pixel(10,20,30);
<span class="lineNum">     456 </span>                : assert(pixel[2] == 30);
<span class="lineNum">     457 </span>                : static_max(pixel) = static_min(pixel);
<span class="lineNum">     458 </span>                : assert(pixel[2] == 10);
<span class="lineNum">     459 </span>                : \endcode
<span class="lineNum">     460 </span>                : \{
<span class="lineNum">     461 </span>                : */
<span class="lineNum">     462 </span>                : 
<span class="lineNum">     463 </span>                : template &lt;typename P&gt;
<span class="lineNum">     464 </span>                : GIL_FORCEINLINE
<span class="lineNum">     465 </span>                : typename element_const_reference_type&lt;P&gt;::type static_max(const P&amp; p) { return detail::min_max_recur&lt;size&lt;P&gt;::value&gt;::max_(p); }
<span class="lineNum">     466 </span>                : 
<span class="lineNum">     467 </span>                : template &lt;typename P&gt;
<span class="lineNum">     468 </span>                : GIL_FORCEINLINE
<span class="lineNum">     469 </span>                : typename element_reference_type&lt;P&gt;::type       static_max(      P&amp; p) { return detail::min_max_recur&lt;size&lt;P&gt;::value&gt;::max_(p); }
<span class="lineNum">     470 </span>                : 
<span class="lineNum">     471 </span>                : template &lt;typename P&gt;
<span class="lineNum">     472 </span>                : GIL_FORCEINLINE
<span class="lineNum">     473 </span>                : typename element_const_reference_type&lt;P&gt;::type static_min(const P&amp; p) { return detail::min_max_recur&lt;size&lt;P&gt;::value&gt;::min_(p); }
<span class="lineNum">     474 </span>                : 
<span class="lineNum">     475 </span>                : template &lt;typename P&gt;
<span class="lineNum">     476 </span>                : GIL_FORCEINLINE
<span class="lineNum">     477 </span>                : typename element_reference_type&lt;P&gt;::type       static_min(      P&amp; p) { return detail::min_max_recur&lt;size&lt;P&gt;::value&gt;::min_(p); }
<span class="lineNum">     478 </span>                : /// \}
<span class="lineNum">     479 </span>                : 
<span class="lineNum">     480 </span>                : /**
<span class="lineNum">     481 </span>                : \defgroup ColorBaseAlgorithmEqual static_equal 
<span class="lineNum">     482 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     483 </span>                : \brief Equivalent to std::equal. Pairs the elements semantically
<span class="lineNum">     484 </span>                : 
<span class="lineNum">     485 </span>                : Example:
<span class="lineNum">     486 </span>                : \code
<span class="lineNum">     487 </span>                : rgb8_pixel_t rgb_red(255,0,0);
<span class="lineNum">     488 </span>                : bgr8_pixel_t bgr_red(0,0,255);
<span class="lineNum">     489 </span>                : assert(rgb_red[0]==255 &amp;&amp; bgr_red[0]==0);
<span class="lineNum">     490 </span>                : 
<span class="lineNum">     491 </span>                : assert(static_equal(rgb_red,bgr_red));
<span class="lineNum">     492 </span>                : assert(rgb_red==bgr_red);  // operator== invokes static_equal
<span class="lineNum">     493 </span>                : \endcode
<span class="lineNum">     494 </span>                : \{
<span class="lineNum">     495 </span>                : */
<span class="lineNum">     496 </span>                : 
<span class="lineNum">     497 </span>                : template &lt;typename P1,typename P2&gt;
<span class="lineNum">     498 </span>                : GIL_FORCEINLINE
<span class="lineNum">     499 </span>                : bool static_equal(const P1&amp; p1, const P2&amp; p2) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_equal(p1,p2); }
<span class="lineNum">     500 </span>                : 
<span class="lineNum">     501 </span>                : /// \}
<span class="lineNum">     502 </span>                : 
<span class="lineNum">     503 </span>                : /**
<span class="lineNum">     504 </span>                : \defgroup ColorBaseAlgorithmCopy static_copy 
<span class="lineNum">     505 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     506 </span>                : \brief Equivalent to std::copy. Pairs the elements semantically
<span class="lineNum">     507 </span>                : 
<span class="lineNum">     508 </span>                : Example:
<span class="lineNum">     509 </span>                : \code
<span class="lineNum">     510 </span>                : rgb8_pixel_t rgb_red(255,0,0);
<span class="lineNum">     511 </span>                : bgr8_pixel_t bgr_red;
<span class="lineNum">     512 </span>                : static_copy(rgb_red, bgr_red);  // same as bgr_red = rgb_red
<span class="lineNum">     513 </span>                : 
<span class="lineNum">     514 </span>                : assert(rgb_red[0] == 255 &amp;&amp; bgr_red[0] == 0);
<span class="lineNum">     515 </span>                : assert(rgb_red == bgr_red);
<span class="lineNum">     516 </span>                : \endcode
<span class="lineNum">     517 </span>                : \{
<span class="lineNum">     518 </span>                : */
<span class="lineNum">     519 </span>                : 
<span class="lineNum">     520 </span>                : template &lt;typename Src,typename Dst&gt;
<span class="lineNum">     521 </span>                : GIL_FORCEINLINE
<span class="lineNum">     522 </span><span class="lineCov">         142932 : void static_copy(const Src&amp; src, Dst&amp; dst) {  detail::element_recursion&lt;size&lt;Dst&gt;::value&gt;::static_copy(src,dst); }</span>
<span class="lineNum">     523 </span>                : 
<span class="lineNum">     524 </span>                : /// \}
<span class="lineNum">     525 </span>                : 
<span class="lineNum">     526 </span>                : /**
<span class="lineNum">     527 </span>                : \defgroup ColorBaseAlgorithmFill static_fill 
<span class="lineNum">     528 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     529 </span>                : \brief Equivalent to std::fill.
<span class="lineNum">     530 </span>                : 
<span class="lineNum">     531 </span>                : Example:
<span class="lineNum">     532 </span>                : \code
<span class="lineNum">     533 </span>                : rgb8_pixel_t p;
<span class="lineNum">     534 </span>                : static_fill(p, 10);
<span class="lineNum">     535 </span>                : assert(p == rgb8_pixel_t(10,10,10));
<span class="lineNum">     536 </span>                : \endcode
<span class="lineNum">     537 </span>                : \{
<span class="lineNum">     538 </span>                : */
<span class="lineNum">     539 </span>                : template &lt;typename P,typename V&gt;
<span class="lineNum">     540 </span>                : GIL_FORCEINLINE
<span class="lineNum">     541 </span>                : void static_fill(P&amp; p, const V&amp; v) {  detail::element_recursion&lt;size&lt;P&gt;::value&gt;::static_fill(p,v); }
<span class="lineNum">     542 </span>                : /// \}
<span class="lineNum">     543 </span>                : 
<span class="lineNum">     544 </span>                : /**
<span class="lineNum">     545 </span>                : \defgroup ColorBaseAlgorithmGenerate static_generate 
<span class="lineNum">     546 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     547 </span>                : \brief Equivalent to std::generate.
<span class="lineNum">     548 </span>                : 
<span class="lineNum">     549 </span>                : Example: Set each channel of a pixel to its semantic index. The channels must be assignable from an integer.
<span class="lineNum">     550 </span>                : \code
<span class="lineNum">     551 </span>                : struct consecutive_fn {
<span class="lineNum">     552 </span>                :     int&amp; _current;
<span class="lineNum">     553 </span>                :     consecutive_fn(int&amp; start) : _current(start) {}
<span class="lineNum">     554 </span>                :     int operator()() { return _current++; }
<span class="lineNum">     555 </span>                : };
<span class="lineNum">     556 </span>                : rgb8_pixel_t p;
<span class="lineNum">     557 </span>                : int start=0;
<span class="lineNum">     558 </span>                : static_generate(p, consecutive_fn(start));
<span class="lineNum">     559 </span>                : assert(p == rgb8_pixel_t(0,1,2));
<span class="lineNum">     560 </span>                : \endcode
<span class="lineNum">     561 </span>                : 
<span class="lineNum">     562 </span>                : \{
<span class="lineNum">     563 </span>                : */
<span class="lineNum">     564 </span>                : 
<span class="lineNum">     565 </span>                : template &lt;typename P1,typename Op&gt;
<span class="lineNum">     566 </span>                : GIL_FORCEINLINE
<span class="lineNum">     567 </span>                : void static_generate(P1&amp; dst,Op op)                      { detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_generate(dst,op); }
<span class="lineNum">     568 </span>                : /// \}
<span class="lineNum">     569 </span>                : 
<span class="lineNum">     570 </span>                : /**
<span class="lineNum">     571 </span>                : \defgroup ColorBaseAlgorithmTransform static_transform 
<span class="lineNum">     572 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     573 </span>                : \brief Equivalent to std::transform. Pairs the elements semantically
<span class="lineNum">     574 </span>                : 
<span class="lineNum">     575 </span>                : Example: Write a generic function that adds two pixels into a homogeneous result pixel.
<span class="lineNum">     576 </span>                : \code
<span class="lineNum">     577 </span>                : template &lt;typename Result&gt;
<span class="lineNum">     578 </span>                : struct my_plus {
<span class="lineNum">     579 </span>                :     template &lt;typename T1, typename T2&gt;
<span class="lineNum">     580 </span>                :     Result operator()(T1 f1, T2 f2) const { return f1+f2; }
<span class="lineNum">     581 </span>                : };
<span class="lineNum">     582 </span>                : 
<span class="lineNum">     583 </span>                : template &lt;typename Pixel1, typename Pixel2, typename Pixel3&gt;
<span class="lineNum">     584 </span>                : void sum_channels(const Pixel1&amp; p1, const Pixel2&amp; p2, Pixel3&amp; result) {
<span class="lineNum">     585 </span>                :     typedef typename channel_type&lt;Pixel3&gt;::type result_channel_t;
<span class="lineNum">     586 </span>                :     static_transform(p1,p2,result,my_plus&lt;result_channel_t&gt;());
<span class="lineNum">     587 </span>                : }
<span class="lineNum">     588 </span>                : 
<span class="lineNum">     589 </span>                : rgb8_pixel_t p1(1,2,3);
<span class="lineNum">     590 </span>                : bgr8_pixel_t p2(3,2,1);
<span class="lineNum">     591 </span>                : rgb8_pixel_t result;
<span class="lineNum">     592 </span>                : sum_channels(p1,p2,result);
<span class="lineNum">     593 </span>                : assert(result == rgb8_pixel_t(2,4,6));
<span class="lineNum">     594 </span>                : \endcode
<span class="lineNum">     595 </span>                : \{
<span class="lineNum">     596 </span>                : */
<span class="lineNum">     597 </span>                : 
<span class="lineNum">     598 </span>                : //static_transform with one source
<span class="lineNum">     599 </span>                : template &lt;typename Src,typename Dst,typename Op&gt;
<span class="lineNum">     600 </span>                : GIL_FORCEINLINE
<span class="lineNum">     601 </span>                : Op static_transform(Src&amp; src,Dst&amp; dst,Op op)              { return detail::element_recursion&lt;size&lt;Dst&gt;::value&gt;::static_transform(src,dst,op); }
<span class="lineNum">     602 </span>                : template &lt;typename Src,typename Dst,typename Op&gt;
<span class="lineNum">     603 </span>                : GIL_FORCEINLINE
<span class="lineNum">     604 </span>                : Op static_transform(const Src&amp; src,Dst&amp; dst,Op op)              { return detail::element_recursion&lt;size&lt;Dst&gt;::value&gt;::static_transform(src,dst,op); }
<span class="lineNum">     605 </span>                : //static_transform with two sources
<span class="lineNum">     606 </span>                : template &lt;typename P2,typename P3,typename Dst,typename Op&gt;
<span class="lineNum">     607 </span>                : GIL_FORCEINLINE
<span class="lineNum">     608 </span>                : Op static_transform(P2&amp; p2,P3&amp; p3,Dst&amp; dst,Op op) { return detail::element_recursion&lt;size&lt;Dst&gt;::value&gt;::static_transform(p2,p3,dst,op); }
<span class="lineNum">     609 </span>                : template &lt;typename P2,typename P3,typename Dst,typename Op&gt;
<span class="lineNum">     610 </span>                : GIL_FORCEINLINE
<span class="lineNum">     611 </span>                : Op static_transform(P2&amp; p2,const P3&amp; p3,Dst&amp; dst,Op op) { return detail::element_recursion&lt;size&lt;Dst&gt;::value&gt;::static_transform(p2,p3,dst,op); }
<span class="lineNum">     612 </span>                : template &lt;typename P2,typename P3,typename Dst,typename Op&gt;
<span class="lineNum">     613 </span>                : GIL_FORCEINLINE
<span class="lineNum">     614 </span>                : Op static_transform(const P2&amp; p2,P3&amp; p3,Dst&amp; dst,Op op) { return detail::element_recursion&lt;size&lt;Dst&gt;::value&gt;::static_transform(p2,p3,dst,op); }
<span class="lineNum">     615 </span>                : template &lt;typename P2,typename P3,typename Dst,typename Op&gt;
<span class="lineNum">     616 </span>                : GIL_FORCEINLINE
<span class="lineNum">     617 </span>                : Op static_transform(const P2&amp; p2,const P3&amp; p3,Dst&amp; dst,Op op) { return detail::element_recursion&lt;size&lt;Dst&gt;::value&gt;::static_transform(p2,p3,dst,op); }
<span class="lineNum">     618 </span>                : /// \}
<span class="lineNum">     619 </span>                : 
<span class="lineNum">     620 </span>                : /**
<span class="lineNum">     621 </span>                : \defgroup ColorBaseAlgorithmForEach static_for_each 
<span class="lineNum">     622 </span>                : \ingroup ColorBaseAlgorithm
<span class="lineNum">     623 </span>                : \brief Equivalent to std::for_each. Pairs the elements semantically
<span class="lineNum">     624 </span>                : 
<span class="lineNum">     625 </span>                : Example: Use static_for_each to increment a planar pixel iterator
<span class="lineNum">     626 </span>                : \code
<span class="lineNum">     627 </span>                : struct increment { 
<span class="lineNum">     628 </span>                :     template &lt;typename Incrementable&gt; 
<span class="lineNum">     629 </span>                :     void operator()(Incrementable&amp; x) const { ++x; } 
<span class="lineNum">     630 </span>                : };
<span class="lineNum">     631 </span>                : 
<span class="lineNum">     632 </span>                : template &lt;typename ColorBase&gt;
<span class="lineNum">     633 </span>                : void increment_elements(ColorBase&amp; cb) {
<span class="lineNum">     634 </span>                :     static_for_each(cb, increment());
<span class="lineNum">     635 </span>                : }
<span class="lineNum">     636 </span>                : 
<span class="lineNum">     637 </span>                : bits8 red[2], green[2], blue[2];
<span class="lineNum">     638 </span>                : rgb8c_planar_ptr_t p1(red,green,blue);
<span class="lineNum">     639 </span>                : rgb8c_planar_ptr_t p2=p1;
<span class="lineNum">     640 </span>                : increment_elements(p1);
<span class="lineNum">     641 </span>                : ++p2;
<span class="lineNum">     642 </span>                : assert(p1 == p2);
<span class="lineNum">     643 </span>                : \endcode
<span class="lineNum">     644 </span>                : \{
<span class="lineNum">     645 </span>                : */
<span class="lineNum">     646 </span>                : 
<span class="lineNum">     647 </span>                : //static_for_each with one source
<span class="lineNum">     648 </span>                : template &lt;typename P1,typename Op&gt;
<span class="lineNum">     649 </span>                : GIL_FORCEINLINE
<span class="lineNum">     650 </span>                : Op static_for_each(      P1&amp; p1, Op op)                          { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,op); }
<span class="lineNum">     651 </span>                : template &lt;typename P1,typename Op&gt;
<span class="lineNum">     652 </span>                : GIL_FORCEINLINE
<span class="lineNum">     653 </span>                : Op static_for_each(const P1&amp; p1, Op op)                          { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,op); }
<span class="lineNum">     654 </span>                : //static_for_each with two sources
<span class="lineNum">     655 </span>                : template &lt;typename P1,typename P2,typename Op&gt;
<span class="lineNum">     656 </span>                : GIL_FORCEINLINE
<span class="lineNum">     657 </span>                : Op static_for_each(P1&amp; p1,      P2&amp; p2, Op op)             { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,op); }
<span class="lineNum">     658 </span>                : template &lt;typename P1,typename P2,typename Op&gt;
<span class="lineNum">     659 </span>                : GIL_FORCEINLINE
<span class="lineNum">     660 </span>                : Op static_for_each(P1&amp; p1,const P2&amp; p2, Op op)             { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,op); }
<span class="lineNum">     661 </span>                : template &lt;typename P1,typename P2,typename Op&gt;
<span class="lineNum">     662 </span>                : GIL_FORCEINLINE
<span class="lineNum">     663 </span>                : Op static_for_each(const P1&amp; p1,      P2&amp; p2, Op op)             { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,op); }
<span class="lineNum">     664 </span>                : template &lt;typename P1,typename P2,typename Op&gt;
<span class="lineNum">     665 </span>                : GIL_FORCEINLINE
<span class="lineNum">     666 </span>                : Op static_for_each(const P1&amp; p1,const P2&amp; p2, Op op)             { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,op); }
<span class="lineNum">     667 </span>                : //static_for_each with three sources
<span class="lineNum">     668 </span>                : template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     669 </span>                : GIL_FORCEINLINE
<span class="lineNum">     670 </span>                : Op static_for_each(P1&amp; p1,P2&amp; p2,P3&amp; p3,Op op) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,p3,op); }
<span class="lineNum">     671 </span>                : template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     672 </span>                : GIL_FORCEINLINE
<span class="lineNum">     673 </span>                : Op static_for_each(P1&amp; p1,P2&amp; p2,const P3&amp; p3,Op op) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,p3,op); }
<span class="lineNum">     674 </span>                : template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     675 </span>                : GIL_FORCEINLINE
<span class="lineNum">     676 </span>                : Op static_for_each(P1&amp; p1,const P2&amp; p2,P3&amp; p3,Op op) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,p3,op); }
<span class="lineNum">     677 </span>                : template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     678 </span>                : GIL_FORCEINLINE
<span class="lineNum">     679 </span>                : Op static_for_each(P1&amp; p1,const P2&amp; p2,const P3&amp; p3,Op op) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,p3,op); }
<span class="lineNum">     680 </span>                : template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     681 </span>                : GIL_FORCEINLINE
<span class="lineNum">     682 </span>                : Op static_for_each(const P1&amp; p1,P2&amp; p2,P3&amp; p3,Op op) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,p3,op); }
<span class="lineNum">     683 </span>                : template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     684 </span>                : GIL_FORCEINLINE
<span class="lineNum">     685 </span>                : Op static_for_each(const P1&amp; p1,P2&amp; p2,const P3&amp; p3,Op op) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,p3,op); }
<span class="lineNum">     686 </span>                : template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     687 </span>                : GIL_FORCEINLINE
<span class="lineNum">     688 </span>                : Op static_for_each(const P1&amp; p1,const P2&amp; p2,P3&amp; p3,Op op) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,p3,op); }
<span class="lineNum">     689 </span>                : template &lt;typename P1,typename P2,typename P3,typename Op&gt;
<span class="lineNum">     690 </span>                : GIL_FORCEINLINE
<span class="lineNum">     691 </span>                : Op static_for_each(const P1&amp; p1,const P2&amp; p2,const P3&amp; p3,Op op) { return detail::element_recursion&lt;size&lt;P1&gt;::value&gt;::static_for_each(p1,p2,p3,op); }
<span class="lineNum">     692 </span>                : ///\}
<span class="lineNum">     693 </span>                : 
<span class="lineNum">     694 </span>                : } }  // namespace boost::gil
<span class="lineNum">     695 </span>                : 
<span class="lineNum">     696 </span>                : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
